package com.seari.controller;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.collections.map.LinkedMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import redis.clients.jedis.Jedis;

import com.seari.bean.AlarmCountMalfunction;
import com.seari.bean.AlarmHistoryData;
import com.seari.bean.AlarmMessageBean;
import com.seari.bean.AlarmQuery;
import com.seari.bean.AllLineRealAlarm;
import com.seari.bean.AllLineStationFault;
import com.seari.bean.HealthImportDevice;
import com.seari.bean.RedisDeploy;
import com.seari.commonutils.redis.JedisUtilProxy;
import com.seari.commonutils.redis.ex.JedisNotInitializeException;
import com.seari.main.StartUpClass;
import com.seari.pojo.MessageBean;
import com.seari.pojo.QueryBase;
import com.seari.service.AlarmService;
import com.seari.utils.IData;
import com.seari.utils.PropertiesUtil;
import com.seari.utils.StringHelper;


@Controller
public class AlarmController {

    @Autowired
    private AlarmService alarmService;
    protected static Logger logger = LoggerFactory.getLogger(AlarmController.class);

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    /**
     * 首页线路图故障趋势
     *
     * @return
     */
    @RequestMapping("/alarm/indexGetAlarmTrend")
    @ResponseBody
    public MessageBean indexGetAlarmTrend() {
        MessageBean messageBean = new MessageBean();
        Map<String, int[]> resultMap = new HashMap<>();
        if (StartUpClass.indexGetAlarmTrend.equals("test")) {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
            int[] yData1 = new int[]{
                    10000, 9930, 9300, 9040, 8090, 8077, 9300, 8064, 7082, 6709, 6500, 8023
            };
            int[] yData2 = new int[]{
                    12000, 9430, 9500, 8040, 8590, 8377, 6600, 8464, 7682, 8709, 7500, 7023
            };
            resultMap.put("yData1", yData1);
            resultMap.put("yData2", yData2);
            messageBean.setData(resultMap);
        } else {
        }
        return messageBean;
    }

    /**
     * 首页线路图各专业故障统计
     *
     * @return
     */
    @RequestMapping("/alarm/indexGetAlarmByType")
    @ResponseBody
    public MessageBean indexGetAlarmByType() {
        MessageBean messageBean = new MessageBean();
        List<Map> typeList = new ArrayList<Map>();
        Map<String, Object> indexMap = new HashMap<>();
        if (StartUpClass.indexGetAlarmByType.equals("test")) {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);

            indexMap.put("EMCS", 2234);
            indexMap.put("FAS", 2311);
            indexMap.put("PSCADA", 321);

            Set entrySet = indexMap.entrySet();
            Iterator it2 = entrySet.iterator();

            while (it2.hasNext()) {
                Map<String, Object> item = new HashMap<String, Object>();
                Entry m = (Entry) it2.next();
                item.put("name", (String) m.getKey());
                item.put("value", m.getValue());
                typeList.add(item);
            }

            messageBean.setData(typeList);
        } else {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
            List<AlarmCountMalfunction> alarmCountMalfunctions = alarmService.queryAlarmMalfunction();
            for (AlarmCountMalfunction alarmCountMalfunction : alarmCountMalfunctions) {
                indexMap.put(alarmCountMalfunction.getAlarmSystem(), alarmCountMalfunction.getCntAlarmSystem());

            }
            Set entrySet = indexMap.entrySet();
            Iterator it2 = entrySet.iterator();

            while (it2.hasNext()) {
                Map<String, Object> item = new HashMap<String, Object>();
                Entry m = (Entry) it2.next();
                item.put("name", (String) m.getKey());
                item.put("value", m.getValue());
                typeList.add(item);
            }

            messageBean.setData(typeList);
        }
        return messageBean;
    }

    /**
     * 首页线路图车站故障统计TOP10
     *
     * @return
     */
    @RequestMapping("/alarm/indexGetAlarmTop")
    @ResponseBody
    public MessageBean indexGetAlarmTop() {
        MessageBean messageBean = new MessageBean();
        Map<String, Object> resultMap = new HashMap<>();
        if (StartUpClass.indexGetAlarmTop.equals("test")) {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
            String[] xData = new String[]{
                    "龙阳路", "老西门", "大连路", "石龙路", "宁国路", "徐家汇", "东兰路", "巨峰路", "陆家嘴", "市光路"
            };
            int[] yData = new int[]{
                    1000, 993, 930, 904, 890, 877, 864, 782, 679, 650
            };
            resultMap.put("xData", xData);
            resultMap.put("yData", yData);
            messageBean.setData(resultMap);
        } else {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
            List<String> xData = new ArrayList<>();
            List<Integer> yData = new ArrayList<>();
            List<AlarmCountMalfunction> QATList = alarmService.queryStationAlarmTop();
            for (int i = 0; i < QATList.size(); i++) {
            	xData.add(QATList.get(i).getStationCn());
            	yData.add(QATList.get(i).getCntAlarmSystem());
			}
            resultMap.put("xData", xData);
            resultMap.put("yData", yData);
            messageBean.setData(resultMap);
        }
        return messageBean;
    }

    /**
     * 首页全网线路故障统计
     *
     * @return
     */
    @RequestMapping("/alarm/indexGetAlarmSum")
    @ResponseBody
    public MessageBean indexGetAlarmSum() {
        MessageBean messageBean = new MessageBean();
        List<Map> typeList = new ArrayList<Map>();
        Map<String, Object> resultMap = new LinkedHashMap<String, Object>();
        if (StartUpClass.indexGetAlarmSum.equals("test")) {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);

            resultMap.put("1", new int[]{648, 843212});
            resultMap.put("2", new int[]{328, 543777});
            resultMap.put("3", new int[]{348, 543212});
            resultMap.put("4", new int[]{532, 442123});
            resultMap.put("6", new int[]{879, 768555});
            resultMap.put("7", new int[]{220, 563312});
            resultMap.put("8", new int[]{435, 890721});
            resultMap.put("12", new int[]{655, 415687});

            Set entrySet = resultMap.entrySet();
            Iterator it2 = entrySet.iterator();

            while (it2.hasNext()) {
                Map<String, Object> item = new HashMap<String, Object>();
                Entry m = (Entry) it2.next();
                item.put("Line", (String) m.getKey());
                item.put("number", m.getValue());
                typeList.add(item);
            }

            messageBean.setData(typeList);

        } else {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
            List<Integer> list12 = alarmService.queryAlarmLineMalfunction();
            resultMap.put("1", new int[]{648, 843212});
            resultMap.put("2", new int[]{328, 543777});
            resultMap.put("3", new int[]{348, 543212});
            resultMap.put("4", new int[]{532, 442123});
            resultMap.put("6", new int[]{879, 768555});
            resultMap.put("7", new int[]{220, 563312});
            resultMap.put("8", new int[]{435, 890721});
            resultMap.put("12", list12);
            Set entrySet = resultMap.entrySet();
            Iterator it2 = entrySet.iterator();

            while (it2.hasNext()) {
                Map<String, Object> item = new HashMap<String, Object>();
                Entry m = (Entry) it2.next();
                item.put("Line", (String) m.getKey());
                item.put("number", m.getValue());
                typeList.add(item);
            }
            messageBean.setData(typeList);
        }
        return messageBean;
    }

    /**
     * 首页全网实时报警
     *
     * @return
     * @throws Exception
     */
    @RequestMapping("/alarm/indexGetAlarmRealTime")
    @ResponseBody
    public MessageBean indexGetAlarmRealTime() throws Exception {
        MessageBean messageBean = new MessageBean();
        List<AlarmMessageBean> alarmMessageBeans = new ArrayList<>();
        if (StartUpClass.indexGetAlarmRealTime.equals("test")) {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
            alarmMessageBeans.add(new AlarmMessageBean(null, "EMCS", "诸光路上行1号扶梯急停信号报警", sdf.format(new Date()), 1, "一级", "station0135", null, null));
            alarmMessageBeans.add(new AlarmMessageBean(null, "EMCS", "上海南站上行1号扶梯急停信号报警", sdf.format(new Date()), 1, "一级", "station0134", null, null));
            alarmMessageBeans.add(new AlarmMessageBean(null, "EMCS", "上海南站上行1号扶梯急停信号报警", sdf.format(new Date()), 1, "一级", "station0135", null, null));
            alarmMessageBeans.add(new AlarmMessageBean(null, "BAS", "莲花路3号闸机票仓将满信号报警", sdf.format(new Date()), 3, "三级", "station0113", null, null));

            messageBean.setData(alarmMessageBeans);
        } else {
            Properties pt = PropertiesUtil.loadConfig("metro_support_backend/src/main/resources/stationId.properties");
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
            List<AlarmMessageBean> alarmData = alarmService.queryAlarmData();
            for (AlarmMessageBean alarmMessageBean : alarmData) {
                String stationId = String.valueOf(pt.get(alarmMessageBean.getStationCn()));
                alarmMessageBean.setStationId(stationId);
                Integer alarmRank = alarmMessageBean.getAlarmRank();
                if (alarmRank == 1) {
                    alarmMessageBean.setAlarmLevel("一级");
                } else if (alarmRank == 2) {
                    alarmMessageBean.setAlarmLevel("二级");
                } else if (alarmRank == 3) {
                    alarmMessageBean.setAlarmLevel("三级");
                } else if (alarmRank == 4) {
                    alarmMessageBean.setAlarmLevel("四级");
                }
                alarmMessageBeans.add(alarmMessageBean);
            }

            messageBean.setData(alarmMessageBeans);

        }
        return messageBean;
    }

    /**
     * 首页线路报警
     *
     * @return
     */
    @RequestMapping("/alarm/indexGetAlarmRealTimeWithLine")
    @ResponseBody
    public MessageBean indexGetAlarmRealTimeWithLine() {
        MessageBean messageBean = new MessageBean();
        Map<String, List<AlarmMessageBean>> resultMap = new HashMap<>();
        if (StartUpClass.indexGetAlarmRealTimeWithLine.equals("test")) {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);

            List<AlarmMessageBean> line1AlarmMessageBean = new ArrayList<>();
            AlarmMessageBean bean1 = new AlarmMessageBean(null, "EMCS", "上海南站上行1号扶梯急停信号报警", sdf.format(new Date()), 1, "一级", null, null, null);
            bean1.setStationCn("上海南站");
            bean1.setStationEn("SHN");
            line1AlarmMessageBean.add(bean1);
            resultMap.put("line1", line1AlarmMessageBean);

            List<AlarmMessageBean> line2AlarmMessageBean = new ArrayList<>();
            AlarmMessageBean bean2 = new AlarmMessageBean(null, "EMCS", "上海南站上行1号扶梯急停信号报警", sdf.format(new Date()), 1, "一级", null, null, null);
            bean2.setStationCn("龙阳路");
            bean2.setStationEn("LYL");
            AlarmMessageBean bean3 = new AlarmMessageBean(null, "EMCS", "上海南站上行1号扶梯急停信号报警", sdf.format(new Date()), 1, "一级", null, null, null);
            bean3.setStationCn("广兰路");
            bean3.setStationEn("GLL");
            line2AlarmMessageBean.add(bean2);
            line2AlarmMessageBean.add(bean3);
            resultMap.put("line2", line2AlarmMessageBean);

            List<AlarmMessageBean> line3AlarmMessageBean = new ArrayList<>();
            AlarmMessageBean bean4 = new AlarmMessageBean(null, "EMCS", "上海南站上行1号扶梯急停信号报警", sdf.format(new Date()), 1, "一级", null, null, null);
            bean4.setStationCn("龙漕路");
            bean4.setStationEn("LCL");
            line3AlarmMessageBean.add(bean4);
            resultMap.put("line3", line3AlarmMessageBean);

            List<AlarmMessageBean> line4AlarmMessageBean = new ArrayList<>();
            AlarmMessageBean bean5 = new AlarmMessageBean(null, "EMCS", "上海南站上行1号扶梯急停信号报警", sdf.format(new Date()), 1, "一级", null, null, null);
            bean5.setStationCn("宜山路");
            bean5.setStationEn("YSL");
            line4AlarmMessageBean.add(bean5);
            resultMap.put("line4", line4AlarmMessageBean);

            List<AlarmMessageBean> line6AlarmMessageBean = new ArrayList<>();
            AlarmMessageBean bean6 = new AlarmMessageBean(null, "EMCS", "上海南站上行1号扶梯急停信号报警", sdf.format(new Date()), 1, "一级", null, null, null);
            bean6.setStationCn("上南路");
            bean6.setStationEn("SNL");
            line6AlarmMessageBean.add(bean6);
            resultMap.put("line6", line6AlarmMessageBean);

            List<AlarmMessageBean> line7AlarmMessageBean = new ArrayList<>();
            AlarmMessageBean bean7 = new AlarmMessageBean(null, "EMCS", "上海南站上行1号扶梯急停信号报警", sdf.format(new Date()), 1, "一级", null, null, null);
            bean7.setStationCn("花木路");
            bean7.setStationEn("HML");
            line7AlarmMessageBean.add(bean7);
            resultMap.put("line7", line7AlarmMessageBean);

            List<AlarmMessageBean> line8AlarmMessageBean = new ArrayList<>();
            AlarmMessageBean bean8 = new AlarmMessageBean(null, "EMCS", "上海南站上行1号扶梯急停信号报警", sdf.format(new Date()), 1, "一级", null, null, null);
            bean8.setStationCn("曲阜路");
            bean8.setStationEn("QFL");
            line8AlarmMessageBean.add(bean8);
            resultMap.put("line8", line8AlarmMessageBean);

            List<AlarmMessageBean> line12AlarmMessageBean = new ArrayList<>();
            AlarmMessageBean bean9 = new AlarmMessageBean(null, "EMCS", "上海南站上行1号扶梯急停信号报警", sdf.format(new Date()), 1, "一级", null, null, null);
            bean9.setStationCn("龙华西路");
            bean9.setStationEn("LHX");
            line12AlarmMessageBean.add(bean9);
            resultMap.put("line12", line12AlarmMessageBean);

            messageBean.setData(resultMap);
        } else {

        }
        return messageBean;
    }

    /**
     * @return 综合监视实时报警
     */
    @RequestMapping("/alarm/realTimeAlerts")
    @ResponseBody
    public MessageBean realTimeAlerts() throws Exception {

        MessageBean messageBean = new MessageBean();
        List<AlarmMessageBean> alarmMessageBeans = new ArrayList<>();
        if (StartUpClass.realTimeAlerts.equals("test")) {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
            alarmMessageBeans.add(new AlarmMessageBean(null, "EMCS", "诸光路上行1号扶梯急停信号报警", sdf.format(new Date()), 1, "一级", "station0135", null, null));
            alarmMessageBeans.add(new AlarmMessageBean(null, "EMCS", "上海南站上行1号扶梯急停信号报警", sdf.format(new Date()), 1, "一级", "station0134", null, null));
            alarmMessageBeans.add(new AlarmMessageBean(null, "EMCS", "上海南站上行1号扶梯急停信号报警", sdf.format(new Date()), 1, "一级", "station0135", null, null));
            alarmMessageBeans.add(new AlarmMessageBean(null, "BAS", "莲花路3号闸机票仓将满信号报警", sdf.format(new Date()), 3, "三级", "station0113", null, null));
            messageBean.setData(alarmMessageBeans);
        } else {
            Properties pt = PropertiesUtil.loadConfig("stationId.properties");
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
            List<AlarmMessageBean> alarmData = alarmService.queryRealTimeAlarmData();
            for (AlarmMessageBean alarmMessageBean : alarmData) {
                String stationId = String.valueOf(pt.get(alarmMessageBean.getStationCn()));
                alarmMessageBean.setStationId(stationId);
                Integer alarmRank = alarmMessageBean.getAlarmRank();
                if (alarmRank == 1) {
                    alarmMessageBean.setAlarmLevel("一级");
                } else if (alarmRank == 2) {
                    alarmMessageBean.setAlarmLevel("二级");
                } else if (alarmRank == 3) {
                    alarmMessageBean.setAlarmLevel("三级");
                } else if (alarmRank == 4) {
                    alarmMessageBean.setAlarmLevel("四级");
                }
                alarmMessageBeans.add(alarmMessageBean);
            }

            messageBean.setData(alarmMessageBeans);
        }
        return messageBean;

    }


    /**
     * @return 综合监视一周报警分级统计
     */
    @RequestMapping("/alarm/alarmGradingStatistics")
    @ResponseBody
    public MessageBean alarmGradingStatistics() {
        MessageBean messageBean = new MessageBean();
        Map<String, int[]> resultMap = new HashMap<>();
        List<Map> typeList = new ArrayList<Map>();
        if (StartUpClass.alarmGradingStatistics.equals("test")) {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
            resultMap.put("TheFaultOf", new int[]{7, 30});
            resultMap.put("FailureRate", new int[]{100, 75});
            Set<Entry<String, int[]>> entrySet = resultMap.entrySet();
            Iterator<Entry<String, int[]>> it = entrySet.iterator();
            while (it.hasNext()) {
                Map<String, Object> item = new HashMap<String, Object>();
                Entry m = (Entry) it.next();
                item.put("name", (String) m.getKey());
                item.put("value", m.getValue());
                typeList.add(item);
            }

            messageBean.setData(typeList);

        } else {


        }

        return messageBean;

    }

    /**
     * @return 综合监视一周服务运维统计
     */
    @RequestMapping("/alarm/operationalStatistics")
    @ResponseBody
    public MessageBean operationalStatistics() {
        MessageBean messageBean = new MessageBean();
        Map<String, String> resultMap = new LinkedHashMap<String, String>();
        List<Map> typeList = new ArrayList<Map>();
        if (StartUpClass.operationalStatistics.equals("test")) {

            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
            resultMap.put("工单完成率", "1");
            resultMap.put("工单响应率", "1");
            resultMap.put("紧急工单率", "0");
            resultMap.put("严重工单率", "0");

            Set<Entry<String, String>> entrySet = resultMap.entrySet();
            Iterator<Entry<String, String>> it = entrySet.iterator();
            while (it.hasNext()) {
                Map<String, Object> item = new HashMap<String, Object>();
                Entry m = (Entry) it.next();
                item.put("name", (String) m.getKey());
                item.put("value", m.getValue());
                typeList.add(item);
            }


            messageBean.setData(typeList);

        } else {


        }

        return messageBean;

    }


    /**
     * @return 综合监视车站故障总览
     */
    @RequestMapping("/alarm/overviewOfStation")
    @ResponseBody
    public MessageBean overviewOfStation() throws Exception {
    	  MessageBean messageBean = new MessageBean();

       
        if (StartUpClass.overviewOfStation.equals("test")) {



        } else {
            Properties pt = PropertiesUtil.loadConfig("stationId.properties");
            Map<String, String> line12 = new HashMap<>();
            Map<String, List> lineMap = new HashMap<>();
            Map<String, List> lineMap2 = new HashMap<>();
            List<Map> typeList12 = new ArrayList<Map>();
            lineMap2.put("line12", typeList12);
            List<AlarmMessageBean> alarmData = alarmService.queryAlarmDataCtOt();
            for (AlarmMessageBean alarmDatum : alarmData) {
//                if(stationCn.indexOf("站")!=-1){
//                    stationCn = stationCn.replace("站","");
//                }
                line12.put(String.valueOf(pt.get(alarmDatum.getStationCn())),String.valueOf(alarmDatum.getAlarmRank()));
            }
//            line12.put("station1220", "0");
//            line12.put("station1222", "2");
//            line12.put("station1223", "0");
//            line12.put("station1224", "1");
//            line12.put("station1225", "0");
//            line12.put("station1226", "3");
            Set<Entry<String, String>> entrySet12 = line12.entrySet();
            Iterator<Entry<String, String>> it12 = entrySet12.iterator();
            while (it12.hasNext()) {

                Map<String, Object> item = new HashMap<String, Object>();
                Entry m = (Entry) it12.next();
                item.put("stationId", m.getKey());
                item.put("state", m.getValue());
                typeList12.add(item);
            }

            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
            lineMap2.put("line12", typeList12);
                lineMap.put("line12",typeList12);
                messageBean.setData(lineMap);

                return messageBean;
        }

        return messageBean;

    }


    /**
     * 综合监视综合信息车站故障统计TOP10
     *
     * @return
     */
    @RequestMapping("/alarm/stationAlarmTop")
    @ResponseBody
    public MessageBean stationAlarmTop() {
        MessageBean messageBean = new MessageBean();
        Map<String, Object> resultMap = new HashMap<>();
        if (StartUpClass.stationAlarmTop.equals("test")) {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
            String[] xData = new String[]{
                    "常熟路", "陕西南路", "人民广场", "汉中路", "徐家汇", "漕宝路", "上海南站", "莘庄"
            };
            int[] yData = new int[]{
                    500, 220, 205, 180, 170, 168, 165, 100
            };
            resultMap.put("xData", xData);
            resultMap.put("yData", yData);
            messageBean.setData(resultMap);
        } else {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
            List<AlarmCountMalfunction> alarmCountTops = alarmService.queryAlarmTop();
            List<String> xData = new ArrayList<>();
            List<Integer> yData = new ArrayList<>();
            for (AlarmCountMalfunction alarmCountTop : alarmCountTops) {
                xData.add(alarmCountTop.getStationCn());
                yData.add(alarmCountTop.getCntAlarmSystem());
                resultMap.put("xData", xData);
                resultMap.put("yData", yData);
            }
            messageBean.setData(resultMap);
        }
        return messageBean;
    }


    /**
     * @return 综合监视车站分类统计
     */
    @RequestMapping("/alarm/classifiedStatistic")
    @ResponseBody
    public MessageBean classifiedStatistic() {
        MessageBean messageBean = new MessageBean();
        Map<String, String> CPUMap = new HashMap<>();
        Map<String, String> internalStorageMap = new HashMap<>();
        Map<String, String> magneticDiskMap = new HashMap<>();
        Map<String, String> rateOfFlowMap = new HashMap<>();
        Map<String, Map> resultMap = new HashMap<>();
        List<Map> typeList = new ArrayList<Map>();
        if (StartUpClass.classifiedStatistic.equals("test")) {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
            CPUMap.put("实时服务器1", "34");
            CPUMap.put("接口服务器1", "31");
            CPUMap.put("接口服务器2", "20");
            internalStorageMap.put("历史服务器1", "25");
            internalStorageMap.put("实时服务器1", "21");
            internalStorageMap.put("接口转发服务器1", "10");
            magneticDiskMap.put("历史服务器1", "23");
            magneticDiskMap.put("历史服务器2", "22");
            magneticDiskMap.put("接口转发服务器1", "10");
            rateOfFlowMap.put("接口转发服务器1", "23");
            rateOfFlowMap.put("远程FEP1", "21");
            rateOfFlowMap.put("远程FEP2", "10");

            resultMap.put("CPU TOP3", CPUMap);
            resultMap.put("内存 TOP3", internalStorageMap);
            resultMap.put("磁盘 TOP3", magneticDiskMap);
            resultMap.put("流量 TOP3", rateOfFlowMap);

            Set<Entry<String, Map>> entrySet = resultMap.entrySet();
            Iterator<Entry<String, Map>> it = entrySet.iterator();
            while (it.hasNext()) {

                Map<String, Object> item = new HashMap<String, Object>();
                Entry m = (Entry) it.next();
                item.put("name", m.getKey());
                item.put("value", m.getValue());

                typeList.add(item);
            }


            messageBean.setData(typeList);


            //messageBean.setData(resultMap);

        } else {


        }

        return messageBean;

    }


    /**
     * @return 综合监视车站接口状态
     */
    @RequestMapping("/alarm/interfaceStatus")
    @ResponseBody
    public MessageBean interfaceStatus() {
        MessageBean messageBean = new MessageBean();
        Map<String, String> resultMap = new LinkedHashMap<String, String>();
        List<Map> StatuList = new ArrayList<Map>();
        if (StartUpClass.interfaceStatus.equals("test")) {

            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
            resultMap.put("EMCS", "1");
            resultMap.put("FAS", "1");
            resultMap.put("PSCADA", "1");
            resultMap.put("CCTV", "1");
            resultMap.put("PA", "1");
            resultMap.put("ATS", "1");

            Set<Entry<String, String>> entrySet = resultMap.entrySet();
            Iterator<Entry<String, String>> it = entrySet.iterator();
            while (it.hasNext()) {
                Map<String, Object> item = new HashMap<String, Object>();
                Entry m = (Entry) it.next();
                item.put("name", (String) m.getKey());
                item.put("value", m.getValue());
                StatuList.add(item);
            }

            messageBean.setData(StatuList);

        } else {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
            List<RedisDeploy>fieldLists = alarmService.getRedisDeploys(StartUpClass.ifStatus);
        	Jedis jedis = null;
        	try {
    			jedis = JedisUtilProxy.getJedis();
    	    	//resultMap = 
    			for (int i = 0; i < fieldLists.size(); i++) {
    				String redisData = jedis.hget(StartUpClass.ifStatus,fieldLists.get(i).getFieldName());
    				resultMap.put(fieldLists.get(i).getFieldName(), redisData);
				}
    		} catch (JedisNotInitializeException e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		}
            Set<Entry<String, String>> entrySet = resultMap.entrySet();
            Iterator<Entry<String, String>> it = entrySet.iterator();
            while (it.hasNext()) {
                Map<String, Object> item = new HashMap<String, Object>();
                Entry m = (Entry) it.next();
                item.put("name", (String) m.getKey());
                item.put("value", m.getValue());
                StatuList.add(item);
            }
            messageBean.setData(StatuList);
        }

        return messageBean;

    }

    /**
     * @return 网络监控状态接口
     */
    @RequestMapping("/alarm/monitoringStatus")
    @ResponseBody
    public MessageBean monitoringStatus() {
        MessageBean messageBean = new MessageBean();
        Map<String, String> resultMap = new LinkedHashMap<String, String>();
        List<Map> StatuList = new ArrayList<Map>();
        if (StartUpClass.interfaceStatus.equals("test")) {

            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
            resultMap.put("EMCS", "1");
            resultMap.put("FAS", "1");
            resultMap.put("PSCADA", "1");
            resultMap.put("CCTV", "1");
            resultMap.put("PA", "1");
            resultMap.put("ATS", "1");

            Set<Entry<String, String>> entrySet = resultMap.entrySet();
            Iterator<Entry<String, String>> it = entrySet.iterator();
            while (it.hasNext()) {
                Map<String, Object> item = new HashMap<String, Object>();
                Entry m = (Entry) it.next();
                item.put("name", (String) m.getKey());
                item.put("value", m.getValue());
                StatuList.add(item);
            }

            messageBean.setData(StatuList);

        } else {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
            List<RedisDeploy>fieldLists = alarmService.getRedisDeploys(StartUpClass.redisKey);
            Jedis jedis = null;
            try {
                jedis = JedisUtilProxy.getJedis();
                //resultMap =
                for (int i = 0; i < fieldLists.size(); i++) {
                    String redisData = jedis.hget(StartUpClass.redisKey,fieldLists.get(i).getFieldName());
                    resultMap.put(fieldLists.get(i).getFieldName(), redisData);
                }
            } catch (JedisNotInitializeException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            Set<Entry<String, String>> entrySet = resultMap.entrySet();
            Iterator<Entry<String, String>> it = entrySet.iterator();
            while (it.hasNext()) {
                Map<String, Object> item = new HashMap<String, Object>();
                Entry m = (Entry) it.next();
                item.put("name", (String) m.getKey());
                item.put("value", m.getValue());
                StatuList.add(item);
            }
            messageBean.setData(StatuList);
        }

        return messageBean;

    }/**
     * @return 网络监控状态接口
     */
    @RequestMapping("/alarm/etStatus")
    @ResponseBody
    public MessageBean etStatus() {
        MessageBean messageBean = new MessageBean();
        Map<String, String> resultMap = new LinkedHashMap<String, String>();
        List<Map> StatuList = new ArrayList<Map>();
        if (StartUpClass.interfaceStatus.equals("test")) {

            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
            resultMap.put("EMCS", "1");
            resultMap.put("FAS", "1");
            resultMap.put("PSCADA", "1");
            resultMap.put("CCTV", "1");
            resultMap.put("PA", "1");
            resultMap.put("ATS", "1");

            Set<Entry<String, String>> entrySet = resultMap.entrySet();
            Iterator<Entry<String, String>> it = entrySet.iterator();
            while (it.hasNext()) {
                Map<String, Object> item = new HashMap<String, Object>();
                Entry m = (Entry) it.next();
                item.put("name", (String) m.getKey());
                item.put("value", m.getValue());
                StatuList.add(item);
            }

            messageBean.setData(StatuList);

        } else {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
            List<RedisDeploy>fieldLists = alarmService.getRedisDeploys(StartUpClass.etStatus);
            Jedis jedis = null;
            try {
                jedis = JedisUtilProxy.getJedis();
                //resultMap =
                for (int i = 0; i < fieldLists.size(); i++) {
                    String redisData = jedis.hget(StartUpClass.etStatus,fieldLists.get(i).getFieldName());
                    resultMap.put(fieldLists.get(i).getFieldName(), redisData);
                }
            } catch (JedisNotInitializeException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            Set<Entry<String, String>> entrySet = resultMap.entrySet();
            Iterator<Entry<String, String>> it = entrySet.iterator();
            while (it.hasNext()) {
                Map<String, Object> item = new HashMap<String, Object>();
                Entry m = (Entry) it.next();
                item.put("name", (String) m.getKey());
                item.put("value", m.getValue());
                StatuList.add(item);
            }
            messageBean.setData(StatuList);
        }

        return messageBean;

    }



    /**
     * @return 设备管理设备分类统计
     */
    @RequestMapping("/alarm/classificationOfEquipment")
    @ResponseBody
    public MessageBean classificationOfEquipment() {
        MessageBean messageBean = new MessageBean();
        Map<String, String> resultMap = new HashMap<>();
        List<Map> typeList = new ArrayList<Map>();
        if (StartUpClass.classificationOfEquipment.equals("test")) {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);

            resultMap.put("EMCS", "20.90");
            resultMap.put("FAS", "17.91");
            resultMap.put("PSCADA", "29.85");
            resultMap.put("CCTV", "17.91");
            resultMap.put("PSD", "13.43");

            Set<Entry<String, String>> entrySet = resultMap.entrySet();
            Iterator<Entry<String, String>> it = entrySet.iterator();
            while (it.hasNext()) {

                Map<String, Object> item = new HashMap<String, Object>();
                Entry m = (Entry) it.next();

                item.put("system", m.getKey());
                item.put("proportion", m.getValue());

                typeList.add(item);
            }


            messageBean.setData(typeList);

        } else {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
            resultMap = alarmService.queryAlarmSystem();
            Set<Entry<String, String>> entrySet = resultMap.entrySet();
            Iterator<Entry<String, String>> it = entrySet.iterator();
            while (it.hasNext()) {

                Map<String, Object> item = new HashMap<String, Object>();
                Entry m = (Entry) it.next();

                item.put("system", m.getKey());
                item.put("proportion", m.getValue());

                typeList.add(item);
            }


            messageBean.setData(typeList);
        }

        return messageBean;

    }

    /**
     * @return 设备管理故障统计
     */
    @RequestMapping("/alarm/deviceFailureStatistics")
    @ResponseBody
    public MessageBean deviceFailureStatistics() {
        MessageBean messageBean = new MessageBean();
        Map<String, Integer> resultMap = new HashMap<>();
        List<Map> typeList = new ArrayList<Map>();
        if (StartUpClass.deviceFailureStatistics.equals("test")) {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);

            resultMap.put("FAS", 50);
            resultMap.put("PSCADA", 55);
            resultMap.put("CCTV", 25);
            resultMap.put("PA", 30);
            resultMap.put("ATS", 5);
            resultMap.put("PSD", 40);

            Set<Entry<String, Integer>> entrySet = resultMap.entrySet();
            Iterator<Entry<String, Integer>> it = entrySet.iterator();
            while (it.hasNext()) {

                Map<String, Object> item = new HashMap<String, Object>();
                Entry m = (Entry) it.next();

                item.put("system", m.getKey());
                item.put("quantity", m.getValue());
                typeList.add(item);
            }
            messageBean.setData(typeList);

        } else {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
            List<AlarmCountMalfunction> alarmCountMalfunctions = alarmService.queryMalfunctionCnt();
            for (AlarmCountMalfunction alarmCountMalfunction : alarmCountMalfunctions) {
                resultMap.put(alarmCountMalfunction.getAlarmSystem(), alarmCountMalfunction.getCntAlarmSystem());

            }
            Set entrySet = resultMap.entrySet();
            Iterator it2 = entrySet.iterator();

            while (it2.hasNext()) {
                Map<String, Object> item = new HashMap<String, Object>();
                Entry m = (Entry) it2.next();
                item.put("system", (String) m.getKey());
                item.put("quantity", m.getValue());
                typeList.add(item);
            }

            messageBean.setData(typeList);
        }
        return messageBean;

    }

    /**
     * @return 设备管理系统健康值
     */
    @RequestMapping("/alarm/systemHealthValue")
    @ResponseBody
    public MessageBean systemHealthValue() {
        MessageBean messageBean = new MessageBean();

        List<Map> typeList = new ArrayList<Map>();
        Map<String, Integer> resultMap = new HashMap<>();
        Map<String, Double> resultMapDouble = new HashMap<>();
        if (StartUpClass.systemHealthValue.equals("test")) {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);

            resultMap.put("EMCS", 98);
            resultMap.put("FAS", 99);
            resultMap.put("PSCADA", 96);

            Set<Entry<String, Integer>> entrySet = resultMap.entrySet();
            Iterator<Entry<String, Integer>> it = entrySet.iterator();
            while (it.hasNext()) {

                Map<String, Object> item = new HashMap<String, Object>();
                Entry m = (Entry) it.next();

                item.put("system", (String) m.getKey());
                item.put("healthIndex", m.getValue());
                typeList.add(item);
            }

            messageBean.setData(typeList);

        } else {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
            resultMapDouble = alarmService.systemHealthValue();
            Set<Entry<String, Double>> entrySet = resultMapDouble.entrySet();
            Iterator<Entry<String, Double>> it = entrySet.iterator();
            while (it.hasNext()) {
                Map<String, Object> item = new HashMap<String, Object>();
                Entry m = (Entry) it.next();
                item.put("system", (String) m.getKey());
                item.put("healthIndex", m.getValue());
                typeList.add(item);
            }
            messageBean.setData(typeList);
        }
        return messageBean;
    }


    /**
     * @return 数据分析全线车站故障统计
     */
    @RequestMapping("/alarm/allLineStationFaultStatistics")
    @ResponseBody
    public MessageBean allLineStationFaultStatistics() {
        MessageBean messageBean = new MessageBean();
        List<AllLineStationFault> statistics = new ArrayList<>();
        if (StartUpClass.allLineStationFaultStatistics.equals("test")) {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);

            statistics.add(new AllLineStationFault("1", "莘庄站", "500", "1000"));
            statistics.add(new AllLineStationFault("2", "外环路站", "500", "1000"));
            statistics.add(new AllLineStationFault("3", "莲花站", "500", "1000"));
            statistics.add(new AllLineStationFault("4", "锦江乐园站", "500", "1000"));
            statistics.add(new AllLineStationFault("5", "上海南站", "500", "1000"));
            statistics.add(new AllLineStationFault("6", "漕宝站", "500", "1000"));
            statistics.add(new AllLineStationFault("7", "上海体育馆站", "500", "1000"));
            statistics.add(new AllLineStationFault("8", "徐家汇站", "500", "1000"));
            statistics.add(new AllLineStationFault("9", "衡山路站", "500", "1000"));
            statistics.add(new AllLineStationFault("10", "常熟路站", "500", "1000"));
            statistics.add(new AllLineStationFault("11", "陕西南路站", "500", "1000"));

            messageBean.setData(statistics);

        } else {
            messageBean.setMessage(StringHelper.MESSAGE_TYPE_SUCCESS);
            List<AllLineStationFault> asfs = alarmService.queryAllLineCntFault();
            for (AllLineStationFault asf:asfs) {
                statistics.add(asf);
            }
            messageBean.setData(statistics);
        }

        return messageBean;

    }


    /**
     * @return 数据分析重要设备故障统计TOP10
     */
    @RequestMapping("/alarm/inportDeviceTop")
    @ResponseBody
    public MessageBean inportDeviceTop() {
        MessageBean messageBean = new MessageBean();
        Map<String, Object> resultMap = new HashMap<>();
        if (StartUpClass.inportDeviceTop.equals("test")) {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
            String[] xData = new String[]{
                    "风阀", "风机", "水泵", "烟感", "温感", "手报", "站台门", "传感器", "防火阀", "开关"
            };
            int[] yData = new int[]{
                    110, 102, 96, 90, 83, 76, 68, 59, 50, 52
            };
            resultMap.put("xData", xData);
            resultMap.put("yData", yData);
            messageBean.setData(resultMap);
        } else {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
    		resultMap = alarmService.queryDeviceTopTen();
    		messageBean.setData(resultMap);
        }
        return messageBean;
    }

    /**
     * 数据分析各级别故障统计
     *
     * @return
     */
    @RequestMapping("/alarm/faultStatisticsAllLevels")
    @ResponseBody
    public MessageBean faultStatisticsAllLevels() {
        MessageBean messageBean = new MessageBean();

        List<Map> typeList = new ArrayList<Map>();
        Map<String, Integer> resultMap = new HashMap<String, Integer>();
        if (StartUpClass.faultStatisticsAllLevels.equals("test")) {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);

            resultMap.put("一级", 10);
            resultMap.put("二级", 20);
            resultMap.put("三级", 30);
            resultMap.put("四级", 60);

            Set entrySet = resultMap.entrySet();
            Iterator it2 = entrySet.iterator();

            while (it2.hasNext()) {
                Map<String, Object> item = new HashMap<String, Object>();
                Entry m = (Entry) it2.next();
                item.put("name", (String) m.getKey());
                item.put("value", m.getValue());
                typeList.add(item);
            }

            messageBean.setData(typeList);

        } else {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
            List<IData> qmrList = alarmService.queryMalfunctionRank();
            List<LinkedMap> reaustList = new ArrayList<LinkedMap>();
            
            IData iData = new IData();
            
            for (int i = 0; i < qmrList.size(); i++) {
                LinkedMap linkedMap = new LinkedMap();
            	
            	if(qmrList.get(i).get("name").equals(1)){
            		linkedMap.put("name", "一级");
            		linkedMap.put("value", qmrList.get(i).get("value"));
            	}
            	if(qmrList.get(i).get("name").equals(2)){
            		linkedMap.put("name", "二级");
            		linkedMap.put("value", qmrList.get(i).get("value"));
            	}
            	if(qmrList.get(i).get("name").equals(3)){
            		linkedMap.put("name", "三级");
            		linkedMap.put("value", qmrList.get(i).get("value"));
            	}
            	if(qmrList.get(i).get("name").equals(4)){
            		linkedMap.put("name", "四级");
            		linkedMap.put("value", qmrList.get(i).get("value"));
            	}
                reaustList.add(linkedMap);
			}
 
            messageBean.setData(reaustList);
        }
        return messageBean;
    }


    /**
     * @return 数据分析全线实时报警
     */
    @RequestMapping("/alarm/allLineRealAlarm")
    @ResponseBody
    public MessageBean allLineRealAlarm(@RequestBody(required = false) AlarmQuery alarmQuery) {
        MessageBean messageBean = new MessageBean();
        if (StartUpClass.allLineRealAlarm.equals("test")) {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
      	  return messageBean;
        } else {
        	
        	messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
      		if (alarmQuery != null) {

    			int pageSize = alarmQuery.getPageSize();
    			alarmQuery.setStart((alarmQuery.getPageNo() - 1) * pageSize);
    			alarmQuery.setLimit(pageSize);
    			List<AllLineRealAlarm>realAlarmList = alarmService.getAllLineRealAlarm(alarmQuery);
    			int resault = alarmService.getAllLineRealAlarmCount(alarmQuery);
    			messageBean.setData(realAlarmList);
    			messageBean.setTotal(resault);

    		}
        }
        	  return messageBean;

    }
    
    
    /**
     * @return 数据分析全线实时报警查询
     */
    @RequestMapping("/alarm/queryAllLineRealAlarm")
    @ResponseBody
    public MessageBean queryAllLineRealAlarm(@RequestBody(required = false) AlarmQuery alarmQuery) {
        MessageBean messageBean = new MessageBean();
        if (StartUpClass.allLineRealAlarm.equals("test")) {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
      	  return messageBean;
        } else {
        	messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
      		if (alarmQuery != null) {
    			int pageSize = alarmQuery.getPageSize();
    			alarmQuery.setStart((alarmQuery.getPageNo() - 1) * pageSize);
    			alarmQuery.setLimit(pageSize);
    			List<AllLineRealAlarm>realAlarmList = alarmService.getAllLineRealAlarm(alarmQuery);
    			int resault = alarmService.getAllLineRealAlarmCount(alarmQuery);
    			messageBean.setData(realAlarmList);
    			messageBean.setTotal(resault);
    		}
        }
        	  return messageBean;

    }

    /**
     * 数据分析重要设备健康指数
     *
     * @return
     */
    @RequestMapping("/alarm/indexImportDevice")
    @ResponseBody
    public MessageBean indexImportDevice() {
        MessageBean messageBean = new MessageBean();
        Map<String, Integer> resultMap = new HashMap<>();
        if (StartUpClass.indexImportDevice.equals("test")) {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
            resultMap.put("healthIndex", 86);
            messageBean.setData(resultMap);
        } else {
        	 messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
        	 int healthIndex = alarmService.getHealthIndex();
             resultMap.put("healthIndex", healthIndex);
             messageBean.setData(resultMap);
        }
        return messageBean;
    }


    /**
     * @return 数据分析重要设备健康度
     */
    @RequestMapping("/alarm/healthImportDevice")
    @ResponseBody
    public MessageBean healthImportDevice(HttpServletRequest req) {
        MessageBean messageBean = new MessageBean();
        List<HealthImportDevice> statistics = new ArrayList<>();
        if (StartUpClass.healthImportDevice.equals("test")) {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
            statistics.add(new HealthImportDevice("1", "感烟报警器", "50", "1000", "5"));
            statistics.add(new HealthImportDevice("2", "感温报警器", "50", "1000", "5"));
            statistics.add(new HealthImportDevice("3", "手报按钮", "50", "1000", "5"));
            statistics.add(new HealthImportDevice("4", "35KV进线开关", "50", "1000", "5"));
            statistics.add(new HealthImportDevice("5", "35KV出线开关", "50", "1000", "5"));
            statistics.add(new HealthImportDevice("6", "35KV分段开关", "50", "1000", "5"));
            statistics.add(new HealthImportDevice("7", "35KV整流变开关", "50", "1000", "5"));
            statistics.add(new HealthImportDevice("8", "35KV电力变开关", "50", "1000", "5"));
            statistics.add(new HealthImportDevice("9", "35KV变压器开关", "50", "1000", "5"));
            statistics.add(new HealthImportDevice("10", "1500V触网闸刀", "50", "1000", "5"));
            messageBean.setData(statistics);

        } else {
        	messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
        	QueryBase qb = new QueryBase();
        	String curPage = req.getParameter("curPage");
        	String limit = req.getParameter("limit");
        	if(StringUtils.isBlank(curPage) || StringUtils.isBlank(curPage)){
        		
        		messageBean.setMessage("参数为空");
        		return messageBean;
        	}else{
            	qb.setStart((Integer.parseInt(curPage) - 1) * Integer.parseInt(limit));
            	qb.setLimit(Integer.parseInt(limit));
        	}

    		List<HealthImportDevice> queryHealthImportDevice = alarmService.queryHealthImportDevice(qb);
    		int count  = alarmService.getDeviceHealthCount();
    		int index = 1;
    		for (int i = 0; i < queryHealthImportDevice.size(); i++) {
    			HealthImportDevice healthImportDevice = queryHealthImportDevice.get(i);
    			healthImportDevice.setDeviceId(String.valueOf(index));
    			statistics.add(healthImportDevice);
    			index += 1 ;
			}
    		 messageBean.setData(statistics);
    		 messageBean.setTotal(count);
        }

        return messageBean;

    }


    /**
     * @return 数据分析重要设备风险指数排行榜
     */
    @RequestMapping("/alarm/inportDeviceRiskIndex")
    @ResponseBody
    public MessageBean inportDeviceRiskIndex() {
        MessageBean messageBean = new MessageBean();
        Map<String, Object> resultMap = new HashMap<>();
        if (StartUpClass.inportDeviceRiskIndex.equals("test")) {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
            String[] xData = new String[]{
                    "风阀", "风机", "水泵", "烟感", "温感", "手报", "站台门", "传感器", "防火阀", "开关"
            };
            int[] yData = new int[]{
                    110, 102, 99, 90, 83, 67, 63, 57, 50, 43
            };
            resultMap.put("xData", xData);
            resultMap.put("yData", yData);
            messageBean.setData(resultMap);
        } else {
            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
        	try{
        	resultMap = alarmService.queryDevicePro();
        	messageBean.setData(resultMap);
        	}catch(Exception e){
        		logger.info("faild to get inportDeviceRiskIndex ! "); 
        	}
        }
        return messageBean;

    }


    /**
     * @return 数据分析获取下拉框选项
     */
    @RequestMapping("/alarm/getDropDownBox")
    @ResponseBody
    public MessageBean getDropDownBox(HttpServletRequest req) {
        MessageBean messageBean = new MessageBean();
        List<String> stations = new ArrayList<String>();
        List<String> systems = new ArrayList<String>();
        List<String> levels = new ArrayList<String>();
        Map<String, Object> resultMap = new HashMap<String, Object>();

        if (StartUpClass.getDropDownBox.equals("test")) {

            messageBean.setCode(StringHelper.MESSAGE_TYPE_SUCCESS);
            stations.add("东方绿舟站");
            stations.add("朱家角站");
            stations.add("淀山湖大道站");
            stations.add("漕盈路站");
            stations.add("青浦新城站");
            stations.add("汇金路站");
            stations.add("赵巷站");
            stations.add("嘉松中路站");
            stations.add("徐泾北城站");
            stations.add("徐盈路站");
            stations.add("蟠龙路站");
            stations.add("诸光路站");
            stations.add("虹桥火车站站");

            systems.add("FAS");
            systems.add("PSCADA");
            systems.add("EMCS");
            systems.add("ATS");
            systems.add("CCTV");
            systems.add("PA");

            levels.add("低");
            levels.add("中");
            levels.add("高");
            levels.add("紧急");

            resultMap.put("stations", stations);
            resultMap.put("systems", systems);
            resultMap.put("levels", levels);


            messageBean.setData(resultMap);

        } else {
        	
        	
        	
        	
        	
        	
        	

        }

        return messageBean;

    }


}
